#include "personinfo.h"
#include "ui_personinfo.h"
#include "user.h"
extern QMap<QString, user*> userMap;

personinfo::personinfo(QString nuser_id,QWidget *parent) :
    user_id(nuser_id), QWidget(parent),
    ui(new Ui::personinfo)
{
    ui->setupUi(this);
    connect(ui->pushButton,&QPushButton::clicked,this,&personinfo::on_pushButton_clicked);

    this->setWindowTitle("用户信息");
    this->setWindowIcon(QIcon(":/new/prefix1/images/icons_head.png"));
}

personinfo::~personinfo()
{
    delete ui;
}

void personinfo::set_head(QPixmap nhead){
    ui->head->setPixmap(nhead);
}
void personinfo::set_job(QString njob){
    ui->job->setText(njob);
}
void personinfo::set_ip(QString nip){
    ui->ip->setText(nip);
}
void personinfo::set_name(QString nname){
    ui->name->setText(nname);
}

void personinfo::on_pushButton_clicked()
{
    if (userMap.contains(user_id)){
        userMap.value(user_id)->show_chat();
    }
}

